<div class="bg-white">
	<header class="mui-bar mui-bar-nav head-bar-nav">
		<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" href="javascript:history.back(-1);"></a>
		<h1 class="mui-title">忘记密码</h1>
	</header>
	<div class="mui-content bg-white">
		<br />
		<br />
		<div class="mui-content-padded login-form-box forget-form-box">
			<div class="mui-input-row">
				<input type="text" class="mui-input-clear j-mobile" placeholder="您的手机号码" />
			</div>
			<div class="mui-input-row">
				<div class="login-code-text">
					<input type="text" class="mui-input-clear j-code" placeholder="短信验证码" data-input-clear="2"><span class="mui-icon mui-icon-clear mui-hidden"></span>
				</div>
				<button  onclick="getCode()"  id="getCode" class="mui-btn login-code-btn">获取验证码</button>
			</div>
			<div class="mui-input-row">
				<input type="password" class="mui-input-clear j-pwd" placeholder="您的新密码" />
			</div>
		</div>
		<br />
		<br />


		<button class="mui-btn mui-btn-block mui-btn-green res-btn">确认</button>

		<br />

	</div>
</div>

<style>

    .dis {
        cursor: no-drop !important;
    }    body{
        background-color:#fff;
    }
</style>





@section Scripts{
<script>


    var but = document.getElementById('getCode');
    var time = 60;
    function getCode() {
        alert('发送成功');
        but.className = 'dis';
        but.setAttribute('disabled', 'disabled')
        var myTime = setInterval(function () {
            if (time == 0) {
                clearInterval(myTime);
                but.removeAttribute('disabled')
                but.innerHTML = '获取验证码';
                but.classList.remove("dis");
                time = 60;
            } else {
                but.innerHTML = time + 's后再次发送';
                time--;
            }
        }, 1000)
    }










	//获取验证码
	$(".login-code-btn").click(function() {
		if ($(".j-mobile").val().length != 11) {
			layerm.open({
				content: '请输入正确的手机号',
				btn: '确定'
			});
			return false;
		}

		$.ajax({
			type: "post",
			url: '@Url.Action("GetMobileCode","Login")',
			data: {
				mobile: $(".j-mobile").val()
			},
			success: function(result) {
				if (result.state == "ok") {
					layerm.open({
						content: '已发送',
						btn: '确定'
					});
				} else {
					layerm.open({
						content: result.msg,
						btn: '确定'
					});
				}
			}
		})
	});

	//修改密码
	$(".res-btn").click(function() {
		if ($(".j-mobile").val().length != 11) {
			layerm.open({
				content: '请输入正确的手机号',
				btn: '确定'
			});
			return false;
		}
		if ($(".j-code").val().length == 0) {
			layerm.open({
				content: '请输入验证码号',
				btn: '确定'
			});
			return false;
		}


		if ($(".j-pwd").val().length < 6 || $(".j-pwd").val().length > 20) {
			layerm.open({
				content: '请输入6-20位密码',
				btn: '确定'
			});
			return false;
		}


		$.ajax({
			type: "post",
			url: '@Url.Action("SetPwd","Login")',
			data: {
				mobile: $(".j-mobile").val(),
				code: $(".j-code").val(),
				pwd: $(".j-pwd").val()
			},
			success: function(result) {
				if (result.state == "ok") {
					layerm.open({
						content: result.msg,
						btn: '确定',
						yes: function() {
							location.href = "/Login/Index";
						}
					});
				} else {
					layerm.open({
						content: result.msg,
						btn: '确定'
					});
				}
			}
		})
	});
</script>


}
